#!/usr/bin/env python
# -*-coding:utf-8-*-
# File    : liyuqi.py

from time import sleep

from selenium import webdriver

username = "xxxx"
password = "xxxx"

driver = webdriver.Chrome()
#超时设置为5秒
driver.implicitly_wait(5)

driver.get("https://www.rabbitpre.com/")
signin_btn = driver.find_element_by_css_selector('#g-j-signin-btn')
signin_btn.click()

login_iframe_window = driver.find_element_by_css_selector('#sso')

driver.switch_to.frame(login_iframe_window)

lw_account_tab = driver.find_element_by_css_selector('span[data-type="tuzhan"]')
lw_account_tab.click()

lw_input_user = driver.find_element_by_css_selector('[placeholder="请输入你的登录账户"]')
lw_input_user.send_keys(username)

lw_input_pw = driver.find_element_by_css_selector('[placeholder="请输入密码"]')
lw_input_pw.send_keys(password)

lw_login_button = driver.find_element_by_css_selector('button.g-btn.login-btn.do-btn')
lw_login_button.click()

sleep(5)

driver.close()

driver.quit()